


import { Component, OnInit, Injector, TemplateRef, ViewChild, Input } from '@angular/core';
import { NgZorroPageBaseComponent } from '../../core/ng-zorro-page-base-component/ng-zorro-page-base-component.component';
import { HttpService } from "../../core/service/http.service";
import { HttpClient } from "@angular/common/http";
import { Router, NavigationExtras } from "@angular/router";
import {
  AndOr, Compare, ExpressionPair, PagedResultDto, PagerSearchInput, ElementViewType, BaseComponentConfig,
  SystemFormControl, FieldType, ElementShowType, CustomNavigation, ClassInfoOutput, NavigatType, ArSystemFormControl, ClassSchool
} from "../..";
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import { CityListComponent } from '../school/cityList';
import {
  FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators,
  FormControl
} from "@angular/forms";



@Component({
  selector: 'app-teacher-class',
  templateUrl: './teacher-class.component.html',
  styleUrls: ['./teacher-class.component.scss']
})
export class TeacherClassComponent extends NgZorroPageBaseComponent implements OnInit {
  cityData;
  provinceData;
  selectedProvince;
  selectedCity;
  schoolName;
  collegelName;
  manalName;
  resultxy;
  resultxymana;
  listEntitiesdata;
  aclear;
  classmana;
  delesh = [];
  disabledButton = true;
  displayData: Array<{ name: string; age: number; address: string; checked: boolean }> = [];
  dataSet = [];
  checkedNumber = 0;
  operating = false;
  smisVisible = false;
  classname;
  editorContent;
  studentstatus = false; // 是否有申请

  // className;
  ngOnInit() {
    this.IniObserver.subscribe(sb => {
      this.getEntityList();
    });

    this.listSearchValue = [
      new ExpressionPair('className', "", Compare.Contains, AndOr.And),
    ];
  }
  constructor(
    injecter: Injector,
    public http1: HttpService,
    private modalService: NzModalService,
    public http: HttpClient

  ) {
    super(injecter,
      new BaseComponentConfig(
        "TeacherInfo/GetAllClassInfoByTeacher",
        "",
        "",
        "",
        "",
        "id",
        "",
        "",
        [],
        "",
        { Edit: false, Dell: false },
      ));



  }



  async searchChange(searchText: string) {
    const that = this;
    clearTimeout(this.aclear);
    this.aclear = setTimeout(() => {
      that.sealist(searchText);
    }, 1000);
  }
  sealist(i) {
    const datalist = { "Name": i };
    this.listEntitiesdata = [];
    this.http1.post<any>("School/GetSchoolToTen", datalist).then(e => {
      this.listEntitiesdata = e;

    });
  }



  studentmanage(id) {
    this.router.navigate(['app/teacherclassindex/studentremove'], {
      queryParams: {
        classId: id
      }
    });
  }


  // 搜索
  classsearch() {
    this.getEntityList();
  }


  // currentPageDataChange($event: Array<{ name: string; age: number; address: string; checked: boolean }>): void {
  //   this.displayData = $event;
  // }
  classsearchinput(e) {
    if (e.keyCode === 13) {
      this.classsearch();
    }
  }
  // 搜索条件
  froalaContent(event) {

  }
  studentapply(id) {
    this.router.navigate(['app/teacherclassindex/studenttair'], {
      queryParams: {
        classId: id
      }
    });
  }
}
